package global

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"gorm.io/gorm/logger"
	"log"
)

var Db *gorm.DB

func init() {
	db, err := gorm.Open(mysql.Open("foods:kkWa~_CNaxLB6^UbN@tcp(localhost:3306)/foods?charset=utf8mb4&parseTime=True&loc=Local"),
		&gorm.Config{
			Logger: logger.Default.LogMode(logger.Info),
		})
	if err != nil {
		log.Fatalf("openDataBase Failed:%s", err.Error())
		return
	}
	Db = db
}
